/**
* -------------------------------------------------------------
* @author  jiao
* @date: 2021-12-31 15:04:01
* @description: Performance serviceImpl
* -------------------------------------------------------------
* @version 1.0.0
* @Copyright (c) 中科星图-版权所有
*/

package com.geovis.boot.service.demo.file.serviceimpl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.geovis.boot.service.demo.file.entity.Performance;
import com.geovis.boot.service.demo.file.mapper.PerformanceMapper;
import com.geovis.boot.service.demo.file.service.IPerformanceService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * 学生接口
 * @author jiao
 */
@Slf4j
@Service
public class IPerformanceServiceImpl extends ServiceImpl<PerformanceMapper, Performance> implements IPerformanceService {

    @Override
    @Transactional(propagation = Propagation.REQUIRES_NEW)
    public void deleteByStudentIdNewTransactional(Integer studentId) {
//      数据库异常：字段异常 student_id12  this.baseMapper.delete(new QueryWrapper<Performance>().eq("student_id12",studentId));

        this.baseMapper.delete(new QueryWrapper<Performance>().eq("student_id",studentId));
    }

    @Override
    public boolean removeException(Integer id) {
        this.baseMapper.deleteById(id);
        //模拟异常
        int a = 1/0;
        return false;
    }
}
